<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>OSS Upload</title>
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>
</head>
<body>
<form method="post" id="upload_form" enctype="multipart/form-data">
    <input type="text" name="key" value=""/>
    <input type="text" name="policy" value=""/>
    <input type="text" name="OSSAccessKeyId" value=""/>
    <input type="text" name="success_action_status" value="200"/>
    <input type="text" name="callback" value=""/>
    <input type="text" name="signature" value=""/>
    <input type="file" name="file"/>
    <input type="submit" value="Upload"/>
</form>
<script type="text/javascript">
    $(function () {

/*        $.post("http://120.24.40.146:9083/api/oss-upload-parameters", {}, function (parms) {
            $("#upload_form").attr("action", parms.uploadUrl);
            $(":input[name=key]").val(parms.objectKey);
            $(":input[name=policy]").val(parms.policy);
            $(":input[name=OSSAccessKeyId]").val(parms.accessId);
            $(":input[name=callback]").val(parms.callback);
            $(":input[name=signature]").val(parms.signature);
        }, "json");*/

        $.ajax("http://120.24.40.146:9083/api/oss-upload-parameters", {
            dataType: "json",
            success: function (parms) {
                $("#upload_form").attr("action", parms.uploadUrl);
                $(":input[name=key]").val(parms.objectKey);
                $(":input[name=policy]").val(parms.policy);
                $(":input[name=OSSAccessKeyId]").val(parms.accessId);
                $(":input[name=callback]").val(parms.callback);
                $(":input[name=signature]").val(parms.signature);
            }
        })
    });
    $(":input[type = summit]").click(
        $.ajax("http://120.24.40.146:9083/api/oss-upload-parameters", {
            dataType: "json",
            success: function (parms) {
                $("#upload_form").attr("action", parms.uploadUrl);
                $(":input[name=key]").val(parms.objectKey);
                $(":input[name=policy]").val(parms.policy);
                $(":input[name=OSSAccessKeyId]").val(parms.accessId);
                $(":input[name=callback]").val(parms.callback);
                $(":input[name=signature]").val(parms.signature);
            }
        })
    )


</script>
</body>
</html>
